"use strict";
cc._RF.push(module, 'd7dbdcJfZhDe513LY8R9Aj7', 'UIManager');
// scripts/UIManager.js

"use strict";

var e = require;
var t = module;
var n = exports;
Object.defineProperty(n, "__esModule", {
  value: !0
});
n.E_GameView = void 0;
var o,
    i = e("NativeAd_Oppo"),
    a = e("ViewBase"),
    r = cc._decorator,
    s = r.ccclass,
    c = r.property;

(function (e) {
  e[e["null"] = -1] = "null";
  e[e.skin = 0] = "skin";
  e[e.tryUse = 1] = "tryUse";
})(o = n.E_GameView || (n.E_GameView = {}));

var l = function (e) {
  __extends(t, e);

  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.viewParent = null;
    t.views = [];
    t.showStart = !1;
    t.nativeAutoClickCDTime = 600;
    t.nativeAd_Oppo = null;
    return t;
  }

  n = t;
  Object.defineProperty(t.prototype, "nativeTriggerTimesToday", {
    get: function get() {
      var e = SDK.Util.Helper.getTodayDate();
      SDK.LocalStorage.getValue("triggerTimes" + e) || SDK.LocalStorage.setValue("triggerTimes" + e, 0);
      return parseInt(cc.sys.localStorage.getItem("triggerTimes" + e));
    },
    set: function set(e) {
      SDK.LocalStorage.setValue("triggerTimes" + SDK.Util.Helper.getTodayDate(), e);
    },
    enumerable: !1,
    configurable: !0
  });
  Object.defineProperty(t, "Inst", {
    get: function get() {
      return n._INST;
    },
    enumerable: !1,
    configurable: !0
  });

  t.prototype.OfflineCloseClick = function () {
    cc.game.end();
  };

  t.prototype.onLoad = function () {
    n._INST = this;
  };

  t.prototype.start = function () {
    if (SDK.Mgr.Inst.curChannel == SDK.Define.Channel.oppo && SDK.Mgr.Inst.customData && SDK.Mgr.Inst.customData.nativeAutoClickCDTime) {
      this.nativeAutoClickCDTime = parseInt(SDK.Mgr.Inst.customData.nativeAutoClickCDTime);
      console.log("nativeAutoClickCDTime", this.nativeAutoClickCDTime);
    }
  };

  t.prototype.autoClick = function () {
    var e = this;
    SDK.Mgr.Inst.curChannel == SDK.Define.Channel.oppo && SDK.Mgr.Inst.isAdOpen && e.nativeAd_Oppo.canShow() && e.nativeTriggerTimesToday < 2 && SDK.Mgr.Inst.gameTime > 180 && SDK.Util.Helper.getCurTimeSecends() - n.preNativeAutoClickTriggerTime > e.nativeAutoClickCDTime && Math.random() < .3 && setTimeout(function () {
      e.nativeAd_Oppo.click();
      n.preNativeAutoClickTriggerTime = SDK.Util.Helper.getCurTimeSecends();
      e.nativeTriggerTimesToday++;
    }, 1500);
  };

  t.prototype.showSkin = function () {
    this.showView(o.skin);
  };

  t.prototype.timeout = function (e) {
    return new Promise(function (t) {
      setTimeout(t, 1e3 * e);
    });
  };

  t.prototype.showView = function (e, t) {
    SDK.Mgr.Inst.showInsert();
    var n;
    n = this.views[e];
    var o = cc.instantiate(n);
    o.setParent(this.viewParent);
    o.getComponent(a["default"]).enter(t);
    o.setSiblingIndex(999);
    return o;
  };

  var n;
  t.preNativeAutoClickTriggerTime = 0;

  __decorate([c(cc.Node)], t.prototype, "viewParent", void 0);

  __decorate([c([cc.Prefab])], t.prototype, "views", void 0);

  __decorate([c(cc.Boolean)], t.prototype, "showStart", void 0);

  __decorate([c(i["default"])], t.prototype, "nativeAd_Oppo", void 0);

  return n = __decorate([s], t);
}(cc.Component);

n["default"] = l;

cc._RF.pop();